@extends('user.base.index')

@section('content')
    <!-- Deafult Table -->
                <div class="block-area" id="defaultStyle">
                    <h3 class="block-title">订单信息管理</h3>
                    @if (session('msg'))
                        <div class="alert alert-success">
                            {{ session('msg') }}
                        </div>
                    @endif
                    <form action='{{ url("admin/complete") }}' method='post' name='myform'>
                        <input type='hidden' name='_token' value='{{ csrf_token() }}'>
                        <input type='hidden' name='_method' value='DELETE'>
                    </form>

                    <form action='{{ url("admin/complete") }}' method='get'>
                        <div class='media-body'>
                            订单号：<input type='text' class='form-control m-b-5' name='name'>
                        </div>
                        
                        <input type='submit' class='btn' value='搜索'>
                    </form>
                    
                    <div class="table-responsive overflow">
                        <table class="tile table table-bordered table-striped">
                            <tbody>
                                <tr><th>未收货</th></tr>
                                <tr>
                                    <th>订单ID</th>
                                    <th>收件人姓名</th>
                                    <th>产品图片</th>
                                    <th>订单状态</th>
                                    <th>收件人地址</th>
                                    <th>收件人电话</th>
                                    <th>数量</th>
                                    <th>总价</th>
                                    <th>备注</th>
                                    <th>操作</th>
                                </tr>
                                 @foreach($list as $v)
                                <tr>
                                    <td>{{$v->id}}</td>
                                    <td>{{$v->receive_name}}</td>
                                    <td><img src="{{ asset('images') }}/{{$v->product_pic}}" width="40%"></td>
                                    <td >
                                        @if($v->status==4)订单完成@endif <br>
                                    </td>
                                    <td>{{ $v->address }}</td>
                                    <td>{{$v->telephone}}</td>
                                    <td>{{$v->product_num}}</td>
                                    <td>{{$v->total_price}}</td>
                                    <td>{{$v->bak}}</td>
                                    <td>
                                        <a href="javascript:doDel({{ $v->id }})" class='btn'>回收站</a>
                                        <a href="/admin/complete/{{ $v->id }}/edit" class='btn'>修改备注</a>
                                    </td>
                                </tr>
                                @endforeach
                            </tbody>
                        </table>
                       
                   
                   
                    <script type="text/javascript">
                        function doDel(id)
                        {
                            if(confirm('确定要放入回收站吗？')){
                                var form = document.myform;
                                form.action = '/admin/complete/'+id;
                                form.submit()
                            }
                        }
                        /*var changeId = '';
                        $(':a').click(function(){
                           var changeId = $(this).attr('sendid');
                        });
                        console.log(changeId);*/
                       /* function doSend(id)
                        {
                            var url = "{{ url('admin/aja/doSend') }}";
                            $.ajax({
                                url:url,
                                async:false,                //是否异步
                                type:'get',                 //请求方式
                                data:{id:id},              //发送的数据
                                dataType:'json',            //响应的数据类型
                                error:function()            //失败时回调函数
                                {
                                    alert('ajax请求失败');
                                },
                                success:function(data)      //成功时回调函数
                                {
                                    if(data==1){
                                        console.log($('#id').html('已发货'));
                                    }else{
                                        alert('该订单已发货');
                                    }
                                }
                            });
                        }*/
                    </script>
                </div>
@stop

